﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <link href="css/Jqbox.css" rel="stylesheet" type="text/css" />
    <link href="css/jquery.loadmask.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="js/ligerui.min.js" type="text/javascript"></script>
    <script src="Js/jquery-jtemplates.js" type="text/javascript"></script>
    <script src="Js/json2.js" type="text/javascript"></script>
    <script src="Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="Js/jquery.loadmask.min.js" type="text/javascript"></script>
    <script src="Js/conmon.js" type="text/javascript"></script>
      <script type="text/javascript">
          var tab = null;
          var accordion = null;
          var tree = null;
          var userid = null;
          $(function () {
              //是否登陆
              $.getJSON('WebServer/MainAdmin.ashx?Action=isLogin&rnd=' + Math.random(), null, function (data) {
                  if (data.IsSuccess == 1) {
                      userid = data.Data.userid;
                      if (data.Data.power == 0) {
                          //一般用户 
                          $("#accordion1").load("_MenuTemplate.htm", null, function () {
                              InitLayout();
                              //默认首页
                              f_addTab('listJoinExam', '参加考试', 'user/listJoinExam.htm');
                          });

                          long_polling();
                      }
                      else if (data.Data.power == 1) {
                          //管理员
                          $("#accordion1").load("_MenuAdminTemplate.htm", null, function () { InitLayout(); });

                          long_polling();
                      }

                  } else if (data.IsSuccess == -9) {
                      $("#pageloading").hide();

                      jqAlert(data.Msg, "提示", function () {
                          window.location.href = "index.htm";
                      });

                  }
              });
          });


          function long_polling() {
              var url = 'webserver/reflush.aspx?userid=' +userid;
              $.ajax({
                  type: "get",
                  dataType: "json",
                  data: "time=" + (new Date().getTime()),
                  url: url,
                  error: function (XmlHttpRequest, textStatus, errorThrown) {
                      // if (XmlHttpRequest.responseText != "") { alert(XmlHttpRequest.responseText); }
                      long_polling();
                  },
                  success: function (d) {
                      //  alert(d.msg);
                      long_polling();
                  }
              });
           }

           function repassword() {
               window.user = {id: $("#userid").val(), name : $("#login_name").text()};
               ShowDialog("sysManage/UpdatePwd.htm", "修改密码", 270, 210);
           }

          // 取得登陆用户的信息
          function show_member_infor() {
              $.getJSON('WebServer/MainAdmin.ashx?Action=getUserInfro&rand=' + Math.random(), null, function (data) {
                  $("#login_name").text(data.name);
                  $("#login_role").text(data.role);
                  $("#login_are").text(data.are);
                  $("#userid").val(data.userid);
              });
          }

          function InitLayout() {

              // 显示用户信息
              show_member_infor();
                
              //布局
              $("#layout1").ligerLayout({ topHeight:60, leftWidth: 180, height: '100%', onHeightChanged: f_heightChanged, allowTopResize:false,allowBottomResize:false });

              var height = $(".l-layout-center").height();

              //Tab
              $("#framecenter").ligerTab({ height: height });

              //面板
              $("#accordion1").ligerAccordion({ height: (height-169), speed: null });

              $(".l-link").hover(function () {
                  $(this).addClass("l-link-over");
              }, function () {
                  $(this).removeClass("l-link-over");
              });

              tab = $("#framecenter").ligerGetTabManager();
              accordion = $("#accordion1").ligerGetAccordionManager();

              // 判断是否是洲管
              $.getJSON('../WebServer/EmpManage.ashx?Action=IsSuperAdminstator&rnd=' + Math.random(), null, function (data) {
                  if (data.superadmin != 1) {
                      $("#topicmanage").hide();
                      $("#btnSys").hide();
                  }
              });
              

              $("#pageloading").hide();
          }

          function f_heightChanged(options) {
              if (tab)
                  tab.addHeight(options.diff);
              if (accordion && options.middleHeight - 20 > 0)
                  accordion.setHeight(options.middleHeight - 20);
          }
          function f_addTab(tabid, text, url) {
              var isFlash = false;
              url = url + "?rnd=" + Math.random();
              if (tab.isTabItemExist(tabid)) {isFlash=true;}
              tab.addTabItem({ tabid: tabid, text: text, url: url });
             
                  var __iframe = $(".l-tab-content-item[tabid=" + tabid + "] iframe", tab.tab.content);
                  $(__iframe).attr("src", $(__iframe).attr("src")); 
             
          }

          function getWindow() {
              if (tab) {
                  if (tab.getSelectedTabItemID() != undefined) {
                     return $(".l-tab-content-item[tabid=" + tab.getSelectedTabItemID() + "] iframe", tab.tab.content)[0].contentWindow;
                  }
              }
               return null;
           }

           function loginout() {
               $.getJSON('WebServer/MainAdmin.ashx?Action=LoginOut&rnd=' + Math.random(), null, function (data) {
                   window.location.href = "index.htm";
               });
           }

           function Sys() {
               ShowDialog("sysManage/setadmin.htm", "系统设置", 350, 400);
           }

           function jmpexam(modelid) {
               url = "../ExamMng/ExamList.htm?modelID="+modelid+"&rnd=" + Math.random();
               if (tab.isTabItemExist('ExamList')) {
                   tab.removeTabItem('ExamList');
               }
               tab.addTabItem({ tabid: 'ExamList', text: '考场管理', url: url });              
           }

           
           function jmp_exam_member(examid, examname) {
               var isFlash = false;
               url = "../ExamMng/candidateList.htm?examID=" + examid + "&rnd=" + Math.random();
               if (tab.isTabItemExist('exam_member' + examid)) {
                   var __iframe = $(".l-tab-content-item[tabid=ExamList] iframe", tab.tab.content);
                   $(__iframe).attr("src", $(__iframe).attr("src"));
               }
               else tab.addTabItem({ tabid: "exam_member" + examid, text: examname, url: url });
           }


           function jmp_member_exam(userid, username) {
               var isFlash = false;
               url = "../ExamMng/userexamlist.htm?userid=" + userid + "&rnd=" + Math.random();
               if (tab.isTabItemExist(userid)) {
                   var __iframe = $(".l-tab-content-item[tabid=ExamList] iframe", tab.tab.content);
                   $(__iframe).attr("src", $(__iframe).attr("src"));
               }
               else tab.addTabItem({ tabid: userid, text: "["+username+"]考试记录", url: url });
           }

     </script> 
    <style type="text/css"> 
        body,html{height:100%;}
    body{ padding:0px; margin:0;   overflow:hidden;}  
    .l-item{ height:26px; line-height:26px; padding-left:10px; text-decoration:underline; color:#333;}
    .l-link{ display:block; height:26px; line-height:26px; padding-left:10px; text-decoration:underline;color:#333;}
    .l-link2{text-decoration:underline; color:white;}
    .l-layout-top{background:#102A49; color:White;}
    .l-layout-bottom{ background:#E5EDEF; text-align:center;}
    #pageloading{position:absolute; left:0px; top:0px; background:white url('css/images/loadings.gif') no-repeat center; width:100%; height:100%;z-index:99999;}
    .l-link{ display:block; line-height:22px; height:22px; padding-left:20px;border:1px solid white; margin:4px;}
    .l-link-over{ background:#FFEEAC; border:1px solid #DB9F00;}
 </style>
</head>
<body style="padding:0px;">
<div id="pageloading"></div> 
 <div id="layout1" style="width:100%">
        <div position="top" style="background:#154d80; color:White;">
            <div style="background-image:url(images/top-logo.png); width:146px; height:59px; float:left; padding-left:10px;"></div>
            <div style="float:left; padding-left:10px; padding-top:10px; font-family:微软雅黑; font-size:2em;">红河分公司员工考试平台</div>
        </div>
        <div position="left"  title="功能导航"> 
            <div id="display" class="l-accordion-header">
                <span style="padding-left:2px;">登陆信息</span>
                <input type="hidden" id="userid" />
            </div>
            <table>
                <tr>
                    <td style="padding-left:10px; padding-top:9px;">姓名:</td>
                    <td style="padding-left:9px; padding-top:9px;"> 
                        <span id="login_name"></span> 
                     </td>
                </tr>
                <tr>
                    <td style="padding-left:10px; padding-top:9px;">职务:</td>
                    <td style="padding-left:9px; padding-top:9px;"> 
                        <span id="login_role"></span> 
                    </td>
                </tr>
                <tr>
                    <td style="padding-left:10px; padding-top:9px; padding-bottom:9px;">区域:</td>
                    <td style="padding-left:9px; padding-top:9px; padding-bottom:9px;"> 
                        <span id="login_are"></span> 
                    </td>
                </tr>
            </table>
            <div style="padding-left:10px; padding-top:9px; padding-bottom:9px;">
                  <table>
                    <tr>
                        <td><input type="button" id="btnGet" value="退出" class="l-button" onclick="loginout();"></td>
                        <td style="padding-left:10px;"><input type="button" id="btnSys" value="设置" class="l-button" onclick="Sys();"></td>
                    </tr>
                  </table>
            </div>
            <div id="accordion1"></div>
        </div>
        <div position="center" id="framecenter"> </div> 
        <div position="bottom">
            Copyright © 2011 
        </div>
    </div> 
</body>
</html>
